
// 消费类型 options
import i18n from '@/utils/i18n'
import dayjs from 'dayjs'
export const consumOption = [
  { value: '01', label: i18n.t('message.hycz') },
  { value: '02', label: i18n.t('message.cdyd') },
  { value: '03', label: i18n.t('message.mpgm') },
  { value: '04', label: i18n.t('message.tcgm') },
  { value: '05', label: i18n.t('message.hykgm') },
  { value: '06', label: i18n.t('message.spgm') },
  { value: '07', label: i18n.t('message.kcbm') },
  { value: '08', label: i18n.t('message.hdbm') },
  { value: '09', label: i18n.t('message.cjfx') },
  { value: '10', label: i18n.t('message.fxfy') },
  { value: '11', label: i18n.t('message.dhyxb') },
  { value: '12', label: i18n.t('message.dc') },
  { value: '29', label: i18n.t('message.dctk') },
  { value: '30', label: i18n.t('message.hyzz') },
  { value: '40', label: i18n.t('message.tx') },
  { value: '51', label: i18n.t('message.yjkc') },
  { value: '72', label: i18n.t('message.tyxf') },
  { value: '98', label: i18n.t('message.yetz') },
  { value: '99', label: i18n.t('message.csje') }
]
// 全局 快捷日期选择
export const shortcuts = [
  {
    text: i18n.t('message.jin7'),
    onClick(picker) {
      const end = new Date()
      const start = new Date()
      end.setTime(start.getTime() + 3600 * 1000 * 24 * 6)
      picker.$emit('pick', [start, end])
    }
  },
  {
    text: i18n.t('message.jin30'),
    onClick(picker) {
      const end = new Date()
      const start = new Date()
      end.setTime(start.getTime() + 3600 * 1000 * 24 * 29)
      picker.$emit('pick', [start, end])
    }
  },
  {
    text: i18n.t('message.jin60'),
    onClick(picker) {
      const end = new Date()
      const start = new Date()
      end.setTime(start.getTime() + 3600 * 1000 * 24 * 59)
      picker.$emit('pick', [start, end])
    }
  },
  {
    text: i18n.t('message.jin90'),
    onClick(picker) {
      const end = new Date()
      const start = new Date()
      end.setTime(start.getTime() + 3600 * 1000 * 24 * 89)
      picker.$emit('pick', [start, end])
    }
  }
]
export const TJshortcuts = [
  {
    text: i18n.t('message.jin7'),
    onClick(picker) {
      const end = new Date()
      const start = new Date()
      start.setTime(end.getTime() - 3600 * 1000 * 24 * 6)
      picker.$emit('pick', [start, end])
    }
  },
  {
    text: i18n.t('message.jin30'),
    onClick(picker) {
      const end = new Date()
      const start = new Date()
      start.setTime(end.getTime() - 3600 * 1000 * 24 * 29)
      picker.$emit('pick', [start, end])
    }
  },
  {
    text: i18n.t('message.jin60'),
    onClick(picker) {
      const end = new Date()
      const start = new Date()
      start.setTime(end.getTime() - 3600 * 1000 * 24 * 59)
      picker.$emit('pick', [start, end])
    }
  },
  {
    text: i18n.t('message.jin90'),
    onClick(picker) {
      const end = new Date()
      const start = new Date()
      start.setTime(end.getTime() - 3600 * 1000 * 24 * 89)
      picker.$emit('pick', [start, end])
    }
  }
]
export const pickerOptionsStatic = {
  shortcuts: [{
    text: i18n.t('message.jin7'),
    onClick(picker) {
      const end = new Date()
      const start = new Date()
      end.setTime(end.getTime())
      start.setTime(start.getTime() - 3600 * 1000 * 24 * 6)
      picker.$emit('pick', [start, end])
    }
  },
  {
    text: i18n.t('message.jin30'),
    onClick(picker) {
      const end = new Date()
      const start = new Date()
      end.setTime(end.getTime())
      start.setTime(start.getTime() - 3600 * 1000 * 24 * 29)
      picker.$emit('pick', [start, end])
    }
  },
  {
    text: i18n.t('message.jin60'),
    onClick(picker) {
      const end = new Date()
      const start = new Date()
      end.setTime(end.getTime())
      start.setTime(start.getTime() - 3600 * 1000 * 24 * 59)
      picker.$emit('pick', [start, end])
    }
  },
  {
    text: i18n.t('message.jin90'),
    onClick(picker) {
      const end = new Date()
      const start = new Date()
      end.setTime(end.getTime())
      start.setTime(start.getTime() - 3600 * 1000 * 24 * 89)
      picker.$emit('pick', [start, end])
    }
  }],
  disabledDate(time) {
    // var curDate = new Date(new Date().toLocaleDateString()).getTime()
    const date = dayjs(new Date()).format('YYYY-MM-DD') + ' 23:59:59'
    var preDate = new Date(date).getTime()
    return time.getTime() > preDate
  }
}
export const pickerOptionsS = { // 精确到秒
  disabledDate(time) {
    return time.getTime() < new Date(new Date().toLocaleDateString()).getTime()
  },
  shortcuts: [
    {
      text: i18n.t('message.jin7'),
      onClick(picker) {
        const end = new Date()
        const start = new Date()
        end.setTime(start.getTime() + 3600 * 1000 * 24 * 7)
        picker.$emit('pick', [start, end])
      }
    },
    {
      text: i18n.t('message.jin30'),
      onClick(picker) {
        const end = new Date()
        const start = new Date()
        end.setTime(start.getTime() + 3600 * 1000 * 24 * 30)
        picker.$emit('pick', [start, end])
      }
    },
    {
      text: i18n.t('message.jin60'),
      onClick(picker) {
        const end = new Date()
        const start = new Date()
        end.setTime(start.getTime() + 3600 * 1000 * 24 * 60)
        picker.$emit('pick', [start, end])
      }
    },
    {
      text: i18n.t('message.jin90'),
      onClick(picker) {
        const end = new Date()
        const start = new Date()
        end.setTime(start.getTime() + 3600 * 1000 * 24 * 90)
        picker.$emit('pick', [start, end])
      }
    }
  ]
}
export const pickerOptionsDis = {
  disabledDate(time) {
    return time.getTime() < new Date(new Date().toLocaleDateString()).getTime()
  }
}
